package p2c.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import p2c.service.IBaseService;

public abstract class BaseAction<T> {

	@Autowired
	private IBaseService<T> baseService;
	
	public final static String TOTAL = "total";//总数据数
	public final static String ROWS = "rows";//行数数据
	public final static String FAILURE = "failure";//错误
	public final static String SUCCESS = "success";//成功
	public final static String ID = "{id}";//ID
	public final static String MAPS = "maps";//分页数据
	public final static String ADD = "add";//添加
	public final static String EDIT = "edit";//修改
	public final static String CLEAR = "clear";//清空 
	public final static String CONGEAL = "congeal";//冻结
	public final static String THAW = "thaw";//解冻
	public final static String DELETE = "delete";//删除
	public final static String FIND = "find";//查询
	public final static String ALL = "all";//所有
	public final static String COUNT = "count";//所有
	public final static String LIST = "list";//可能用于树形
	
	@RequestMapping(method=RequestMethod.POST)
	public Object create(@Valid Model model,BindingResult result,HttpServletRequest request,HttpServletResponse response) {
		return null;
	}
	
	@RequestMapping(value=ID,method=RequestMethod.DELETE)
	public Object delete(@Valid Model model,BindingResult result,HttpServletRequest request,HttpServletResponse response) {
		return null;
	}
	
	@RequestMapping(value=ID,method=RequestMethod.PUT)
	public Object update(@Valid Model model,BindingResult result,HttpServletRequest request,HttpServletResponse response) {
		return null;
	}
	
	@RequestMapping(value=ID,method=RequestMethod.GET)
	public Object retrieve(@Valid Model model,BindingResult result,HttpServletRequest request,HttpServletResponse response) {
		return null;
	}
}
